﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SES.CMS.BL;
using SES.CMS.DAL;
using SES.CMS.DO;
using System.Data;

namespace SES.CMS.Module
{
    public partial class ucModuleTopCate : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            { rptModuleTopCateDataSource(); 
           
            }
        }
        protected void rptModuleTopCateDataSource()
        {
            DataTable dtModule = new cmsArticleBL().BindToModuleHomepage(1, 2);
            rptModuleTopCate.DataSource = dtModule;
            rptModuleTopCate.DataBind();
            if (dtModule.Rows.Count > 0)
            {
                ltrCategoryTitle.Text = dtModule.Rows[0]["CategoryTitle"].ToString();
            }
        }

        protected string FriendlyUrl(string s)
        {
            return Ultility.Change_AV(s);
        }
        public string FriendlyUrl2(string s)
        {
            return Ultility.Change_AV2(s);
        }

        public string CategoryTitle(string CategoryID)
        {
            string CategoryTitle = "";
            CategoryTitle = FriendlyUrl2(new cmsCategoryBL().Select(new cmsCategoryDO { CategoryID = int.Parse(CategoryID) }).Title);
            return CategoryTitle;
        }
    }
}